package io.gitee.hfl.rocketmq.msg;

import java.io.Serializable;

/**
 * @author hefulin
 * @date 2022/9/7 15:56
 */
public class RocketMessage<T> implements Serializable {

    private static final long serialVersionUID = -8706760422771420636L;

    private String type;
    private String mode;
    private T data;

    public RocketMessage() {
    }

    public RocketMessage(String type, String mode, T data) {
        this.type = type;
        this.mode = mode;
        this.data = data;
    }

    public static <T> RocketMessage<T> build(String type, String mode, T data) {
        return new RocketMessage<>(type, mode, data);
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getMode() {
        return mode;
    }

    public void setMode(String mode) {
        this.mode = mode;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "RocketMessage{" +
                "type='" + type + '\'' +
                ", mode='" + mode + '\'' +
                ", data=" + data +
                '}';
    }

}
